part of '../../repository.dart';

const _kWebPurchasedSubscriptionActiveStatusValue = 'active';
const _kWebPurchasedSubscriptionExpiredStatusValue = 'expired';
const _kWebPurchasedSubscriptionRevokedStatusValue = 'revoked';

class _WebPurchasedSubscriptionStatusDto extends Equatable {
  const _WebPurchasedSubscriptionStatusDto._internal({
    required this.statusString,
  });

  final String statusString;

  @override
  List<Object?> get props {
    return [
      statusString,
    ];
  }

  factory _WebPurchasedSubscriptionStatusDto.fromString(String statusString) {
    return _WebPurchasedSubscriptionStatusDto._internal(
      statusString: statusString,
    );
  }

  WebPurchasedSubscriptionStatus toEntity() {
    return switch (statusString) {
      _kWebPurchasedSubscriptionActiveStatusValue => WebPurchasedSubscriptionStatus.active,
      _kWebPurchasedSubscriptionExpiredStatusValue => WebPurchasedSubscriptionStatus.expired,
      _kWebPurchasedSubscriptionRevokedStatusValue => WebPurchasedSubscriptionStatus.revoked,
      _ => throw UnimplementedError(),
    };
  }
}
